<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <style>
      .myclass1{
        background-color: red;
      }
    </style>
  </head>
  <body>
    <div id="root">
    <span :class="myclass" @mouseover="change" @mouseout="change4">教父</span>
    <span :class="myclass1" @mouseover="change1" @mouseout="change4">阿甘正传</span>
    <span :class="myclass2" @mouseover="change2" @mouseout="change4">楚门的世界</span>
    <span :class="myclass3" @mouseover="change3" @mouseout="change4">盗梦空间</span>
     </div>
  </body>
  <script>
    Vue.config.productionTip = false;
    new Vue({
      el: "#root",
      data() {
        return {
          myclass:'myclass1',
          myclass1:'',
          myclass2:'',
          myclass3:'',
        }
      },
      methods: {
        change(){
          this.myclass="myclass1"
        
        },
         change1(){
          this.myclass1="myclass1"
          this.myclass=''
        },
         change2(){
          this.myclass2="myclass1"
          this.myclass=''
        },
         change3(){
          this.myclass3="myclass1"
          this.myclass=''
        },
        change4(){
          this.myclass='myclass1'
          this.myclass1=''
          this.myclass2=''
          this.myclass3=''
        }
      },
    });
  </script>
</html>
